{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e9c55172-13f0-4251-952b-2c6f3c07a9b3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "随机生成一个二维整数数组arr1:\n",
      " [[7 5 2]\n",
      " [6 7 2]\n",
      " [3 3 9]]\n",
      "随机生成一个一维整数数组arr2:\n",
      " [1 8 8]\n",
      "随机生成一个二维小数数组arr3:\n",
      " [[3.58074678 1.14254896 0.13851637]\n",
      " [2.7361991  2.87604037 7.62526485]\n",
      " [7.15415895 3.51451669 1.83405778]]\n",
      "arr1和arr2相加:\n",
      " [[ 8 13 10]\n",
      " [ 7 15 10]\n",
      " [ 4 11 17]]\n",
      "arr1和arr3相乘:\n",
      " [[25.06522745  5.71274479  0.27703274]\n",
      " [16.41719458 20.13228257 15.25052971]\n",
      " [21.46247685 10.54355008 16.50652005]]\n",
      "以arr1为底数，arr2为指数的幂:\n",
      " [[       7   390625      256]\n",
      " [       6  5764801      256]\n",
      " [       3     6561 43046721]]\n",
      "arr1的倒数:\n",
      " [[0.14285714 0.2        0.5       ]\n",
      " [0.16666667 0.14285714 0.5       ]\n",
      " [0.33333333 0.33333333 0.11111111]]\n",
      "arr3四舍五入，小数点后保留一位:\n",
      " [[3.6 1.1 0.1]\n",
      " [2.7 2.9 7.6]\n",
      " [7.2 3.5 1.8]]\n",
      "arr1的余弦值:\n",
      " [[0.99254615 0.9961947  0.99939083]\n",
      " [0.9945219  0.99254615 0.99939083]\n",
      " [0.99862953 0.99862953 0.98768834]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "arr1 = np.random.randint(1,10, size=(3,3))\n",
    "print('随机生成一个二维整数数组arr1:\\n',arr1)\n",
    "arr2 = np.random.randint(1,10, size=3)\n",
    "print('随机生成一个一维整数数组arr2:\\n',arr2)\n",
    "arr3 = np.random.rand(3,3)*10\n",
    "print('随机生成一个二维小数数组arr3:\\n',arr3)\n",
    "print('arr1和arr2相加:\\n',np.add(arr1,arr2))\n",
    "print('arr1和arr3相乘:\\n',np.multiply(arr1,arr3))\n",
    "print('以arr1为底数，arr2为指数的幂:\\n',np.power(arr1,arr2,dtype='int64'))\n",
    "print('arr1的倒数:\\n',np.reciprocal(arr1,dtype='float'))\n",
    "print('arr3四舍五入，小数点后保留一位:\\n',np.around(arr3,decimals=1))\n",
    "print('arr1的余弦值:\\n',np.cos(arr1*np.pi/180))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e4e3e970-bd24-4381-937a-1659a1a234cf",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "606d2ac2-de4a-4894-b9e2-ad7a7f58a3ff",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
